package org.itstack.demo.design.cuisine.impl;

import org.itstack.demo.design.AuthInfo;
import org.itstack.demo.design.AuthLink;
import org.itstack.demo.design.AuthService;

import java.util.Date;

/**
 * @Author: fanYuLe
 * @CreateTime: 2023-12-26  10:51
 * @Description: 一级负责人
 */
public class Level1AuthLink extends AuthLink {
    public Level1AuthLink(String levelUserId, String levelUserName) {
        super(levelUserId, levelUserName);
    }

    @Override
    public AuthInfo doAuth(String uId, String orderId, Date authDate) {
        Date date = AuthService.queryAuthInfo(levelUserId, orderId);
        if(null==date){
            return new AuthInfo("001","单号：",orderId," 状态：待一级审批负责人 ",levelUserName);
        }
        AuthLink next = super.next();
        if(null==next){
            return new AuthInfo("0000","单号：",orderId," 状态：一级审批完成负责人"," 时间：",f.format(date),"审批人：",levelUserName);
        }
        return next.doAuth(uId,orderId,authDate);
    }
}
